import request from '@/config/axios'

/** 绘本分类信息 */
export interface ShelfCatalogue {
          id: number; // 绘本目录表ID
          categoryName: string; // 分类名称
          type: number; // 1:英文书架 2:中文书架
  }

// 绘本分类 API
export const ShelfCatalogueApi = {
  // 查询绘本分类分页
  getShelfCataloguePage: async (params: any) => {
    return await request.get({ url: `/book/shelf-catalogue/page`, params })
  },

  // 查询绘本分类详情
  getShelfCatalogue: async (id: number) => {
    return await request.get({ url: `/book/shelf-catalogue/get?id=` + id })
  },

  // 新增绘本分类
  createShelfCatalogue: async (data: ShelfCatalogue) => {
    return await request.post({ url: `/book/shelf-catalogue/create`, data })
  },

  // 修改绘本分类
  updateShelfCatalogue: async (data: ShelfCatalogue) => {
    return await request.put({ url: `/book/shelf-catalogue/update`, data })
  },

  // 删除绘本分类
  deleteShelfCatalogue: async (id: number) => {
    return await request.delete({ url: `/book/shelf-catalogue/delete?id=` + id })
  },

  /** 批量删除绘本分类 */
  deleteShelfCatalogueList: async (ids: number[]) => {
    return await request.delete({ url: `/book/shelf-catalogue/delete-list?ids=${ids.join(',')}` })
  },

  // 导出绘本分类 Excel
  exportShelfCatalogue: async (params) => {
    return await request.download({ url: `/book/shelf-catalogue/export-excel`, params })
  }
}
